﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Domain;
using Persistence;
using Persistence.Dao;
namespace web.usercontrol
{
    public partial class head : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Web.UI.HtmlControls.HtmlGenericControl js = new System.Web.UI.HtmlControls.HtmlGenericControl();
            js.TagName = "script";
            js.Attributes.Add("src", "/public/jquery/jquery.js");
            js.Attributes.Add("type", "text/javascript");
            this.Page.Header.Controls.AddAt(0, js);

            System.Web.UI.HtmlControls.HtmlGenericControl js1 = new System.Web.UI.HtmlControls.HtmlGenericControl();
            js1.TagName = "script";
            js1.Attributes.Add("src", "/public/js/common.js");
            js1.Attributes.Add("type", "text/javascript");
            this.Page.Header.Controls.AddAt(0, js1);

            System.Web.UI.HtmlControls.HtmlGenericControl js2 = new System.Web.UI.HtmlControls.HtmlGenericControl();
            js2.TagName = "script";
            js2.Attributes.Add("src", "/public/js/login.js");
            js2.Attributes.Add("type", "text/javascript");
            this.Page.Header.Controls.AddAt(0, js2);


            HtmlLink link1 = new HtmlLink();
            link1.Attributes.Add("type", "text/css");
            link1.Attributes.Add("rel", "stylesheet");
            link1.Attributes.Add("href", "~/css/cssm.css");
            this.Page.Header.Controls.AddAt(0, link1);

            HtmlLink link = new HtmlLink();
            link.Attributes.Add("type", "text/css");
            link.Attributes.Add("rel", "stylesheet");
            link.Attributes.Add("href", "~/css/indexm.css");
            this.Page.Header.Controls.AddAt(0,link);

            BindTitle(4, menuRpt);

        }

        private void BindTitle(int type, Repeater rpt)
        {
            rpt.DataSource = Singleton<NewsDao>.Instance.GetModels("top 10 *", "newstype=" + type, "newsid asc", 10, 1);
            rpt.DataBind();
        }
    }
}